﻿using System;

using System.Resources;
using System.Reflection;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace mForum.Core.Infrastructure.Resource
{
    using mForum.Core.Common;

    public static class ResourceHelper
    {
        private static ResourceManager _resourceManager;

        public static void Initialize(ResourceManager resourceManager)
        {
            Check.Argument.IsNotNull(resourceManager, "resourceManager");

            _resourceManager = resourceManager;
        }

        public static string GetErrorMessage(string key)
        {
            string errorMessage = _resourceManager.GetString(key); 

            if (errorMessage == null)
                throw new ArgumentException(_resourceManager.GetString(ResourceKey.Common.InvalidMessage));

            return errorMessage;
        }
    }
}
